<template>
  <div>
    <h1 style="text-align:center;margin-bottom:20px">数据添加</h1>
    <el-form label-position="right" label-width="80px" :model="formLabelAlign">
      <el-form-item label="产品名称">
        <el-input v-model="formLabelAlign.name"></el-input>
      </el-form-item>
      <el-form-item label="产品地址">
        <el-input v-model="formLabelAlign.address"></el-input>
      </el-form-item>
      <el-form-item label="产品描述">
        <el-input v-model="formLabelAlign.desc"></el-input>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="handleClick">确定</el-button>
        <el-button type="warning" @click="clear">重置</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>
<script>
export default {
  data() {
    return {
      formLabelAlign: {
        name: "",
        address: "",
        desc: "",
        id: new Date().getTime().toString(),
      }
    };
  },
  methods: {
    handleClick() {
      this.$store.commit('Add_List', this.formLabelAlign)
      this.$router.push('/home/list')
    },
    clear() {
      this.formLabelAlign.name = ''
      this.formLabelAlign.address = ''
      this.formLabelAlign.desc = ''
    }
  }
};
</script>